package org.JWCB.friend.controller.exam;

import org.JWCB.common.core.controller.BaseController;
import org.JWCB.common.core.domain.dto.QueryDto;
import org.JWCB.common.core.domain.vo.R;
import org.JWCB.friend.domain.exam.dto.ExamQueryDto;
import org.JWCB.common.core.domain.vo.TableDataInfo;
import org.JWCB.friend.domain.exam.dto.ExamRankQueryDto;
import org.JWCB.friend.domain.exam.vo.ExamFirstQuestionVo;
import org.JWCB.friend.domain.exam.vo.ExamListItemVo;
import org.JWCB.friend.service.exam.ExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/exam")
public class ExamController extends BaseController {

    @Autowired
    private ExamService examService;
    @GetMapping("/semiLogin/list")
    public TableDataInfo list(@Validated ExamQueryDto examQueryDto) {
        return examService.list(examQueryDto);
    }




    @GetMapping("firstQuestion")
    public R<ExamFirstQuestionVo> firstQuestion(Long examId) {
        return R.ok(examService.firstQuestion(examId));
    }

    @GetMapping("nextQuestion")
    public R<String> nextQuestion(Long examId,Long questionId) {
        return R.ok(examService.nextQuestion(examId,questionId));
    }


    @GetMapping("prevQuestion")
    public R<String> prevQuestion(Long examId,Long questionId) {
        return R.ok(examService.prevQuestion(examId,questionId));
    }

    @GetMapping("/semiLogin/rank/list")
    public TableDataInfo rankList(@Validated ExamRankQueryDto queryDto) {
        return examService.rankList(queryDto);
    }
}
